import React from 'react'
import { Menu } from 'antd'
import type { MenuProps } from 'antd';
import { useLocation, useNavigate } from 'react-router-dom';

interface PropsType {
  items: MenuProps['items']
}

const SiderMenus: React.FC<PropsType> = ({ items }) => {
  // 获取访问路径
  const location = useLocation();
  const pathname = location.pathname
  // 获取跳转
  const navigate = useNavigate()
  return (
    <Menu
      items={items}
      theme="dark"
      selectedKeys={[pathname]}
      onClick={({ key }) => /* 跳转页面 */ navigate(key) }
    ></Menu>
  )
}


export default SiderMenus